UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p3ld+M8P1hNbWaCMH+fZEnHhLeXIdMSYQebxljiQDCY='
WHERE
key_id = '002059c187243e0b986bee73259f7e72c899c40244dcccc1b0d93b744df4d7cb'
AND (
token = 'p3ld+M8P1hNbWaCMH+fZEnHhLeXIdMSYQebxljiQDCY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)