UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eTE9AEOdlGZIyFKeoMJfdN+GAZ7QYZLyR5gE1ouofWM='
WHERE
key_id = '87edc774ebccf7ce45cee02bfddc35ef30b59fe7fdd0f2e09031cebca3963b8d'
AND (
token = 'eTE9AEOdlGZIyFKeoMJfdN+GAZ7QYZLyR5gE1ouofWM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)