UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c1P4tdB4IcCuMoFJS6EUIk6AN8BpiQGVvecUk/4W1/s='
WHERE
key_id = 'd5442fe5ac6c67de30a505664b10d58ee07d80a90d65d6a3755fa32afd5ee665'
AND (
token = 'c1P4tdB4IcCuMoFJS6EUIk6AN8BpiQGVvecUk/4W1/s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)