UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'buS6QSKNbMjPx0Z9iVuOlbAVpWUsNjmjPMibo3FRJ54=' 
WHERE 
  key_id = 'f263e7e00acd2c44e07151de8c109f48fda15621ef4989f1c1e530c16b1da029' 
  AND (
    token = 'buS6QSKNbMjPx0Z9iVuOlbAVpWUsNjmjPMibo3FRJ54=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028