UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o1Gni3l4JDW42f8CqpbB72kUNpgIgl5fowEdALZQQ8w='
WHERE
key_id = 'ca8ca5834a9dfcbb8e3f3572493c5b5a2a5d38cbc46bde34d8ae5eff30c560a1'
AND (
token = 'o1Gni3l4JDW42f8CqpbB72kUNpgIgl5fowEdALZQQ8w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)