UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gaqLK86ec7hMR7u8Q3NUHMgrtXmSr62MOhB8L/3MDvE='
WHERE
key_id = 'd6065b68720e52a235ccf3a00c9ef2db520fa7219da275cb09b10c5d4f082958'
AND (
token = 'gaqLK86ec7hMR7u8Q3NUHMgrtXmSr62MOhB8L/3MDvE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)