UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/NxLZAdhDrcMkQaJcTbnGaft+7NyFNUT6+S2n+cKbuM=' 
WHERE 
  key_id = 'b2c878abcae1006e293d5f2e5849606dfad4bbec04caf066fce2460b12f24807' 
  AND (
    token = '/NxLZAdhDrcMkQaJcTbnGaft+7NyFNUT6+S2n+cKbuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068