UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7P540xHVE00sbJUHjJdcr5Y57cjiK8VOfUrLmXHNDGA='
WHERE
key_id = '865472dd239e1f9fd61b6db8dc8fee09a3ebea41c37e953b77353d62f4bbe350'
AND (
token = '7P540xHVE00sbJUHjJdcr5Y57cjiK8VOfUrLmXHNDGA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)