UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JBS4z8POFKwoGALrkUnZbyCNExnQcTbbgf/UmGewW0Y='
WHERE
key_id = '58908b81002d5cd7db1aa6cf61b30e2bb030eb1813a8cde447512803c6b419d5'
AND (
token = 'JBS4z8POFKwoGALrkUnZbyCNExnQcTbbgf/UmGewW0Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)