UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'esdknxxUjsQ8nzp6K4PBY9X2rl1xeGq3Tjzvhlp7vS0=' 
WHERE 
  key_id = '6ad4ee51802605beb3780176dbb984f00a8fe9393e013f4641563828944bde40' 
  AND (
    token = 'esdknxxUjsQ8nzp6K4PBY9X2rl1xeGq3Tjzvhlp7vS0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045