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