UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HHCxA1uPMx7AE2wu83epbp4zl+AUk7B91WO1/mka/Ok=' 
WHERE 
  key_id = 'ced2c3f272a7bbdd49682f57a880c799565f2b5ef6c9ccdf02c20867ba7b79f1' 
  AND (
    token = 'HHCxA1uPMx7AE2wu83epbp4zl+AUk7B91WO1/mka/Ok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032