UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fYmaYqohTWkKo00+2yjB4SPRrvSxhW3rokhTjNSzqZw=' 
WHERE 
  key_id = '78cae58d425893be6eccc266e3a0ab4c7021dd4c69d0744b910265585732722c' 
  AND (
    token = 'fYmaYqohTWkKo00+2yjB4SPRrvSxhW3rokhTjNSzqZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033