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