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