UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k01mCKR2FU26ZxB2GWqkHjOlp79n3WT707urUZWvh+I=' 
WHERE 
  key_id = 'febe3d8cfe023b3476f35c95c4479bf8b7eadb34f2b029ce5fe943317a0583e5' 
  AND (
    token = 'k01mCKR2FU26ZxB2GWqkHjOlp79n3WT707urUZWvh+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037