UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '50lpm6KiDLUz96Hv+f0tbn1s6yOErHkNWEP0cLIbUKs='
WHERE
key_id = '17c553c5ba56520fede63ffbfc925e714820326922f4f34718143a42e5540bb7'
AND (
token = '50lpm6KiDLUz96Hv+f0tbn1s6yOErHkNWEP0cLIbUKs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)