UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f+5c8mLOZqxuUY534buU4/ZWlUWvK4/+yvdCNGTF/Sc=' 
WHERE 
  key_id = 'd412ce2914494729677c2774794605d26c416b66246530140a20d18041d2a6b0' 
  AND (
    token = 'f+5c8mLOZqxuUY534buU4/ZWlUWvK4/+yvdCNGTF/Sc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043