UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2M4ORi6Pxzwed/QaVVfwOi8xQXQ0DD+gNmTtwInCrp8='
WHERE
key_id = '2c4bbc2e11c388277dc063d58320449ac18ac1ec1e8ca07a15c10d9508b306d4'
AND (
token = '2M4ORi6Pxzwed/QaVVfwOi8xQXQ0DD+gNmTtwInCrp8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)