UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B8RRpQAdfLeGPjy56407h+eFP8/lHr86uUc/0LynzjM=' 
WHERE 
  key_id = 'c7a51f9024bb50548fda04c1379dda75f316a50714305134469ab4fb615a8255' 
  AND (
    token = 'B8RRpQAdfLeGPjy56407h+eFP8/lHr86uUc/0LynzjM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043