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