UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e7Cs5TxC0Wy5UtYct9j/1CGEt9E2AnssQlBZ2rknJ1w='
WHERE
key_id = '5665b5a23fa060443d02fd0c8b900f8186633b6eebf863b3c9d87aaa2603c998'
AND (
token = 'e7Cs5TxC0Wy5UtYct9j/1CGEt9E2AnssQlBZ2rknJ1w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)