UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XJZdSYXK9vCE0S7+/o29Kuu0hFIl3dfHeuYk80W1XCc='
WHERE
key_id = '6c813553c82f7ae99f2045c8b7cfeea11cfed7b9d45435abb0500d68489ad2dc'
AND (
token = 'XJZdSYXK9vCE0S7+/o29Kuu0hFIl3dfHeuYk80W1XCc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)