UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1jr+A6wMsGfCKYN7czG/cPZoPQDJfNbza31bU1o+Ih8=' 
WHERE 
  key_id = '28b380a6c91c47db6c4915ce4f608998991cc6425b897a3a7b4460138441de2f' 
  AND (
    token = '1jr+A6wMsGfCKYN7czG/cPZoPQDJfNbza31bU1o+Ih8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018