UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sj93JD4y3TOs4jO2Dy+gb6rwICunrJm7sofp+qFpueA=' 
WHERE 
  key_id = '0b2bd180ecceeb6d215c8b4ac51d1f1f2491aa76a9e2d7aad800b09127cb8e67' 
  AND (
    token = 'sj93JD4y3TOs4jO2Dy+gb6rwICunrJm7sofp+qFpueA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049