UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7ys+hJ+lRH690as8k7mPHqmfGmjHi6YrY7pfhxV3aX8='
WHERE
key_id = '0ed77c08df894a34debfb33810ad339c0240aac6a34a04b5146a0ea5fd744896'
AND (
token = '7ys+hJ+lRH690as8k7mPHqmfGmjHi6YrY7pfhxV3aX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)