UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZJH0roi970SMCef/yc1+Iz1tQM5+TJEvm58avrVXUfw=' 
WHERE 
  key_id = '08866bd9de83b619dfd3436033a8f62fe44c0e1a3ee8b52500d8bc5416c7bb24' 
  AND (
    token = 'ZJH0roi970SMCef/yc1+Iz1tQM5+TJEvm58avrVXUfw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034