UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Az/i2xvfLNuLKNKRKE2VmWb6PtjUIDuBBw5pdb3DCro='
WHERE
key_id = 'b9c28ca2923586c50b76d8c94b5b52c5c632a52ceeaa357a745655f4bf6abe45'
AND (
token = 'Az/i2xvfLNuLKNKRKE2VmWb6PtjUIDuBBw5pdb3DCro='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)