UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kDR8OM3UZDplGF35FkuIyUB3xBVQQZTkFkAuZL0cX90='
WHERE
key_id = '18fbcbf958ffb2f1c93084416dd1c17aba1586fa321c8399f4f6caa11518f72f'
AND (
token = 'kDR8OM3UZDplGF35FkuIyUB3xBVQQZTkFkAuZL0cX90='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)