UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zWGu2Yo+14lmJdEDUN6gfIIkXiFBXAASgoXMGQAR4+4='
WHERE
key_id = 'ff31abce9906f29a9332efd9e16815aca59ab436f74a89a446b838f278d2379d'
AND (
token = 'zWGu2Yo+14lmJdEDUN6gfIIkXiFBXAASgoXMGQAR4+4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)