UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xTASwlVBxc3PuknKOZkpxGRaywA+GkLLDW8bSeg5QKk='
WHERE
key_id = 'bc3f7f101b0edf448d0ed3ed79a0a626ad8ee433a67a74d3d31b38235a6c3fe1'
AND (
token = 'xTASwlVBxc3PuknKOZkpxGRaywA+GkLLDW8bSeg5QKk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)